Don't collect headers and macros from dependencies transitively#98
Merged
chrisnovakovic merged 1 commit intoplease-build:masterfrom Nov 28, 2025
Merged
Conversation
…ncies Header files and macro definitions are currently collected from dependencies transitively, which is too aggressive. The only headers required to compile a C/C++ source file are the ones included by that source file, and the only macros that should be defined on the command line are the ones necessary to compile that source file. Collecting headers transitively pollutes the build environment (and increases the probability of unnecessary header name clashes); collecting macro definitions transitively risks causing action at a distance, especially for macros that change the meaning or behaviour of functions defined in the standard library (e.g. `_XOPEN_SOURCE`). Only collect headers exposed by direct dependencies, and don't collect macro definitions from dependencies at all. Fixes please-build#95.
toastwaffle
approved these changes
Nov 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Header files and macro definitions are currently collected from dependencies transitively, which is too aggressive. The only headers required to compile a C/C++ source file are the ones included by that source file, and the only macros that should be defined on the command line are the ones necessary to compile that source file. Collecting headers transitively pollutes the build environment (and increases the probability of unnecessary header name clashes); collecting macro definitions transitively risks causing action at a distance, especially for macros that change the visibility or behaviour of functions defined in the standard library (e.g.
_XOPEN_SOURCE).Only collect headers exposed by direct dependencies, and don't collect macro definitions from dependencies at all.
Fixes #95.